<?

if($Db->connect()){

  if($_SESSION["modify_mode"] == "Y"){


  }else{


  }

  echo  "<table border='1' class='dedeq'>\n".
        "<tr>\n".

        "<th> No                        </th>\n".

        "<th> Drop                      </th>\n".

        "<th> Account <br/> Sub Account </th>\n".

        "<th> Description               </th>\n".

        "<th> Amount                    </th>\n".

        "<th> Equivalen                 </th>\n".

        "</tr>\n";

  for($iRow = 0; $iRow < $_SESSION["init_num"]; $iRow++){

    $propAmount   = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                     GMisc.syncVal2(\"amountEnt[".$iRow."]\",
                                                    \"totAmount\");").

                    $GJs->jsOnBlur ("GMisc.setWhite2(this);
                                     GMisc.sumVal2F(\"amountEnt[".$iRow."]\",
                                                    \"totAmount\");");

    $propNet      = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                     GMisc.syncVal2(\"netEnt[".$iRow."]\",
                                                    \"totNet\");
                                     Misc.equivalen(\"netEnt[".$iRow."]\",
                                                    \"rateEnt\",
                                                    \"amountEnt[".$iRow."]\");").

                    $GJs->jsOnBlur ("GMisc.setWhite2(this);
                                     GMisc.sumVal2F(\"netEnt[".$iRow."]\",
                                                    \"totNet\");");

    $lstGlAcc     = $Misc->retArray($_POST["glAccEnt"][$iRow]);

    $lstGlSubAcc  = $Misc->retArray($_POST["glSubAccEnt"][$iRow]);

    /**
     * prop with array is not going to be applied!!!
     */
    $prop["glAcc"]            = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                                 Ajax.setGlAcc(this);").

                                $GJs->jsOnBlur ("GMisc.setWhite2(this);");

    $prop["glAccCode"]        = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                                 Ajax.setGlAccCode(this,
                                                                   \"glAccEnt[".$iRow."]\");").

                                $GJs->jsOnBlur ("GMisc.setWhite2(this);");

    $prop["glSubAcc"]         = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                                 Ajax.setGlSubAcc(this,
                                                                  \"glAccCodeEnt[".$iRow."]\");").

                                $GJs->jsOnBlur ("GMisc.setWhite2(this);");

    $prop["glSubAccCode"]     = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                                 Ajax.setGlSubAccCode(this,
                                                                      \"glAccCodeEnt[".$iRow."]\",
                                                                      \"glSubAccEnt[".$iRow."]\");").

                                $GJs->jsOnBlur ("GMisc.setWhite2(this);");

    $prop["drop"]             = $GJs->jsOnChange("Misc.procDrop(this,
                                                                \"prevStatus[".$iRow."]\",
                                                                \"amountEnt[".$iRow."]\",
                                                                \"totAmount\",
                                                                \"netEnt[".$iRow."]\",
                                                                \"totNet\");");

    echo  "<tr>\n".

          "<td> ".($iRow + 1)." </td>\n".

          "<td> ".$GHtml->formCheckBox("dropBox[]",
                                       ($iRow + 1),
                                       $prop["drop"])."

                ".$GHtml->formHidden("prevStatus[".$iRow."]",
                                     $_POST["prevStatus"][$iRow])." </td>\n".

          "<td> <table border=0>
                <tr>

                <td> ".$GHtml->formDropDown("glAccEnt[".$iRow."]",
                                            $_POST["glAccEnt"][$iRow],
                                            $lstGlAcc,
                                            $prop["glAcc"])." </td>

                <td> ".$GHtml->formInput("glAccCodeEnt[".$iRow."]",
                                         $_POST["glAccCodeEnt"][$iRow],
                                         $Misc->stdNumStyle(5).
                                         $prop["glAccCode"])." </td>

                <td> ".$GHtml->formDropDown("glSubAccEnt[".$iRow."]",
                                            $_POST["glSubAccEnt"][$iRow],
                                            $lstGlSubAcc,
                                            $prop["glSubAcc"])." </td>

                <td> ".$GHtml->formInput("glSubAccCodeEnt[".$iRow."]",
                                         $_POST["glSubAccCodeEnt"][$iRow],
                                         $Misc->stdNumStyle(10).
                                         $prop["glSubAccCode"])." </td>

                </tr>
                </table></td>\n".

        "<td> ".$GHtml->formInput("descpEnt[".$iRow."]",
                                  $_POST["descpEnt"][$iRow],
                                  $Misc->stdStyle(50).
                                  $Misc->stdProperties())." </td>\n".

        "<td> ".$GHtml->formInput("amountEnt[".$iRow."]",
                                  $_POST["amountEnt"][$iRow],
                                  $Misc->stdNumStyle100().
                                  $propAmount)." </td>\n".

        "<td> ".$GHtml->formInput("netEnt[".$iRow."]",
                                  $_POST["netEnt"][$iRow],
                                  $Misc->stdNumStyle100().
                                  $propNet)." </td>\n".

        "</tr>\n";
  }

  echo  "<tr>\n".

        "<td ".$GHtml->rowColSpan( 1, 3)." align='center'><b> TOTAL </b></td>\n".

        "<td name='txButton' align='center'> </td>\n".

        "<td> ".$GHtml->formInput("totAmount",
                                  $_POST["totAmount"],
                                  $Misc->stdNumStyle100().
                                  $Misc->stdProperties())." </td>\n".

        "<td> ".$GHtml->formInput("totNet",
                                  $_POST["totNet"],
                                  $Misc->stdNumStyle100().
                                  $Misc->stdProperties())." </td>\n".

        "</tr>\n".
        "</table><br/>\n";

  echo  $GJs->jsScript("","Misc.setSuppCst(\"typeEnt\",
                                           \"supplierCustomer\");
                           Ajax.setButton(\"txEnt\",
                                          \"txButton\");");

  echo  $GHtml->formInputButton( "Entry-data",
                                 "entry",
                                 "Entry-data",
                                 $stlButton).
  			$GHtml->formInputButton( "Add-row",
                                 "addrow",
                                 "Add-row",
                                 $stlButton).
        $GHtml->formInputButton( "Drop-row",
                                 "droprow",
                                 "Drop-row",
                                 $stlButton).
      	"</form>\n ".
      	"</body>\n";

  $Db->dc();
}else{

  $Misc->usrDie(_DB_CONN_ERROR);
}

?>